/*    */ package com.hp.bon.sgw.core.processor;
/*    */ 
/*    */ import com.hp.bon.sgw.Constants;
/*    */ import com.hp.bon.sgw.core.CallParam;
/*    */ import com.hp.bon.sgw.core.channel.handler.IAsynCallHandler;
/*    */ import com.hp.bon.sgw.util.dcc.DccAvpHelper;
/*    */ import com.hp.ocs.diameter.message.AVP;
/*    */ import com.hp.ocs.diameter.message.AVP_Grouped;
/*    */ import com.hp.ocs.diameter.message.AVP_UTF8String;
/*    */ import com.hp.ocs.diameter.message.AVP_Unsigned32;
/*    */ import com.hp.ocs.diameter.message.Message;
/*    */ import com.hp.ocs.diameter.message.MessageDictionary;
/*    */ import java.util.LinkedHashMap;
/*    */ import java.util.Map;
/*    */ import org.slf4j.Logger;
/*    */ 
/*    */ public class FluxBalanceMsgProcessor extends Processor
/*    */ {
/*    */   public int process(CallParam callParam)
/*    */   {
/* 26 */     Message request = (Message)callParam.getRequest();
/*    */ 
/* 28 */     Message answer = new Message();
/* 29 */     answer.prepareResponse(request);
/* 30 */     MessageDictionary md = request.getDictionary();
/* 31 */     md.prepareResponseAVP(answer);
/*    */ 
/* 33 */     AVP avp = null;
/* 34 */     Map neBalanceMap = new LinkedHashMap();
/*    */     try {
/* 36 */       avp = request.find(873, 10415);
/* 37 */       AVP_Grouped serviceInfsAVP = new AVP_Grouped(avp);
/* 38 */       avp = serviceInfsAVP.find(80020, 81000);
/* 39 */       AVP_Grouped netCtrlInfsAVP = new AVP_Grouped(avp);
/*    */ 
/* 41 */       AVP[] neInfAVPs = netCtrlInfsAVP.queryAVPs();
/* 42 */       for (AVP theAVP : neInfAVPs) {
/* 43 */         if (theAVP.code() == 80021) {
/* 44 */           AVP_Grouped neInfAVP = new AVP_Grouped(theAVP);
/* 45 */           String hostID = new AVP_UTF8String(neInfAVP.find(80024, 81000)).queryValue();
/* 46 */           int balance = new AVP_Unsigned32(neInfAVP.find(80034, 81000)).queryValue();
/* 47 */           neBalanceMap.put(hostID, Integer.valueOf(balance));
/*    */         }
/*    */       }
/* 50 */       answer.add(new AVP_Unsigned32(268, 2001));
/* 51 */       answer.add(DccAvpHelper.genDefaultServiceResultAVP(0));
/*    */ 
/* 53 */       callParam.setRetCode(2001);
/*    */     } catch (Exception e) {
/* 55 */       Constants.LOG.warn("parse  ccr err: ", e);
/* 56 */       answer.add(new AVP_Unsigned32(268, 5012));
/* 57 */       callParam.setRetCode(5012);
/*    */     }
/*    */ 
/* 60 */     callParam.setResponse(answer);
/* 61 */     callParam.getAsynHandler().onCallResult(callParam);
/*    */ 
/* 64 */     return 0;
/*    */   }
/*    */ 
/*    */   public int endProcess(CallParam callParam)
/*    */   {
/* 70 */     return 0;
/*    */   }
/*    */ }

/* Location:           C:\Users\think\Desktop\sgw_2.1.jar
 * Qualified Name:     com.hp.bon.sgw.core.processor.FluxBalanceMsgProcessor
 * JD-Core Version:    0.6.1
 */